define_extension :sources, :checkout do
  require "capistrano/recipes/deploy/scm"
  
  set(:scm) { Capistrano::Deploy::SCM::new(scm_type, self) }
  set(:scm_type) { use_configuration_value }
  
  task :sources do
    brev = build_repository[real_revision]

    brev.setup!
    command = scm.checkout(real_revision, brev.src_path)

    logger.debug { "executing: #{command}" }
    if !syscmd(command)
      raise "sources checkout error"
    end    
  end
end

